   10 DEF FN a(x)=INT (65535+444280*(x-.5)^3)
   20 DEF FN h()=PEEK UDG CHR$ 168+256*PEEK (1+UDG CHR$ 168)+65536*PEEK (2+UDG CHR$ 168)
   30 POKE (3+UDG CHR$ 168),0
   40 IF PEEK 21807<>62 THEN UDGSETUP
   50 IF PEEK 21991<>7 THEN PALSETUP
   60 LET bg=15: LET ro=8: LET ot=1329063: INTROCOLARRAY: GO TO 7000
   70 GO TO 7000
   80 MODE 4: CSIZE 8,8: BORDER bg: PAPER bg: PEN 0: FLASH 0: OVER 0: INVERSE 0
   90 CLS : RANDOMIZE : LET mines=10*(sk+1): LET ad=0: LET hf=0
  100 LET mines=10*(sk+1): LET target=ot:INTEREST
  110 REM *** MAIN LOOP
  120 WALLS 1,ro
  130 DIM c(mines): DIM d(mines): DIM m$(20,31): LET tr=0
  140 FOR n=1 TO mines
  150 LET mr=INT (RND*19)+1: LET mc=INT (RND*30)+1
  160 LET c(n)=mr: LET d(n)=mc: LET m$(mr,mc)="m"
  170 PRINT AT c(n),d(n);CHR$ 145
  180 NEXT n
  190 LET e=INT (RND*13)+1: LET f=INT (RND*30)+1: IF m$(e,f)="m" THEN GO TO 190
  200 LET m$(e,f)="t"
  210 PRINT AT e,f; PEN 6; FLASH 1;CHR$ 147
  220 ZOOM : ZOOM : ZOOM : FOR n=1 TO 1000: NEXT n: BOOM 
  230 FOR n=1 TO mines: PRINT AT c(n),d(n); PEN 4;" ": NEXT n: PRINT AT e,f; PEN 6;CHR$ 147
  240 LET a=21: LET b=16
  250 PRINT AT a,b; PEN 1;CHR$ 144
  260 LET k$=INKEY$
  270 LET dx=(-1 AND k$="o" AND b>1 AND a<21)+(1 AND k$="p" AND b<30 AND a<21)
  280 LET dy=(-1 AND k$="q" AND a>1)+(1 AND k$="a" AND (a<20 OR (a=20 AND b=16)))
  290 IF dx=0 AND dy=0 THEN GO TO 250
  300 PRINT AT a,b;" "
  310 IF a=20 AND b=16 AND dy=1 THEN LET u$=" ": ELSE LET u$=m$(a+dy,b+dx)
  320 LET a=a+dy: LET b=b+dx
  330 IF u$="m" THEN GO TO 370
  340 IF u$="t" THEN GO SUB 390
  350 IF tr=1 AND a=21 AND b=16 THEN GO TO 420
  360 GO TO 250
  370 REM *** HIT MINE
  380 ASPLODE: GO TO 2000
  390 REM *** GOT TREASURE
  400 ZOOM : LET tr=1: LET m$(a,b)=" "
  410 RETURN 
  420 REM *** EXIT CAVE
  430 PRINT AT a,b; PEN 1;CHR$ 144
  440 LET da=FN a(RND)
  450 ZOOM : BOOM : ZOOM : FOR n=1 TO 20: PRINT PEN (3 AND n MOD 2=1)+(10 AND n MOD 2=0); AT a,b;CHR$ 144: NEXT n
  460 FANFARE
  470 FOR n=1 TO 20: PRINT AT n,1;STRING$(30," "): NEXT n
  480 PEN 3: PLOT 39,145: DRAW 177,0: DRAW 0,-10: DRAW -177,0: DRAW 0,10: PEN 10: PLOT 40,144: DRAW 175,0: PEN 0
  490 PRINT AT 4,5; PAPER 10; PEN 7;"  SO FAR,  SO HOOPY!  ": BOOM 
  500 CASH da: PRINT AT 7,7-0.5*LEN cash$;"The bag contains ";cash$: BOOM 
  510 LET ad=ad+da: CASH ad: PRINT AT 9,9-0.5*LEN cash$;"You now have ";cash$: BOOM 
  520 IF ad>target THEN GO TO 1000
  530 PRINT AT 17,2;"Prepare for the next cave...": PAUSE 200: FOR n=1 TO 20: PRINT AT n,1;STRING$(30," "): NEXT n
  540 LET tr=0: LET mines=mines+1
  550 GO TO 110
 1000 REM *** YOU'RE WINNER
 1010 FOR n=1 TO 20: PRINT AT n,1;STRING$(30," "): NEXT n: PRINT AT 3,7; PEN 1;"___________________"
 1020 PEN 5: PLOT 55,145: DRAW 153,0: DRAW 0,-18: DRAW -153,0: DRAW 0,18: PEN 0
 1030 PRINT PAPER 1; PEN 7; AT 4,7;"  CONGRATURATION!  "; AT 5,7;"   YOU  SUCSESS!   "
 1040 CASH ad: PRINT AT 9,8.5-0.5*LEN cash$;"You collected "; PEN 9;cash$; PEN 0; AT 10,4;"and paid off your debts,"
 1050 LET net=ad-target: CASH net: PRINT AT 11,10-LEN cash$;"leaving "; PEN 6;cash$; PEN 0;" to spend on"; AT 12,2;"Pan-Galactic Gargle Blasters"; AT 13,2;"in the welcoming company of"; AT 14,5;"Eccentrica Gallumbits!"
 1060 FOR n=9 TO 127 STEP 2: PALETTE 13,n
 1070 PRINT PAPER 1; PEN 13; AT 4,7;"  CONGRATURATION!  "; AT 5,7;"   YOU  SUCSESS!   "
 1080 BEEP .002,n/2: BEEP .002,76-n/2: NEXT n
 1090 ZOOM : BOOM : ZOOM : BOOM : ZOOM : FOR n=1 TO 1000: NEXT n
 1100 FOR n=9 TO 14: PRINT AT n,1;STRING$(30," "): NEXT n
 1110 CASH ad: PRINT AT 9,8.5-0.5*LEN cash$;"You collected "; PEN 9;cash$: ZOOM 
 1120 LET hf=0: CHECKHISC
 1130 IF hf=1 THEN NEWHISC 1
 1140 IF hf=0 THEN CASH FN h(): PRINT AT 12,6-0.5*LEN cash$;"High score is still"; PEN 6;cash$: BOOM : BOOM : BOOM 
 1150 PAUSE 1: PRINT AT 15,5;"Press   to scrape Ford"; AT 16,4;"off the floor of the bar"; AT 17,3;"in downtown Han Dold City"; AT 18,8;"and play again..."; AT 15,11; PAPER 10; PEN 3;"R"; AT 14,11; PAPER bg; PEN 10;"_"
 1160 GET k$
 1170 IF k$="r" OR k$="R" THEN GO TO 80
 1190 PRINT AT 0,0;STRING$(513," ")
 1999 STOP 
 2000 REM *** YOU FAIL IT
 2010 FOR n=1 TO 20: PRINT AT n,1;STRING$(30," "): NEXT n: PRINT #0; AT 0,0;STRING$(64," ");
 2015 PEN 9: PLOT 63,145: DRAW 129,0: DRAW 0,-10: DRAW -129,0: DRAW 0,10: PEN 0: PLOT 64,144: DRAW 127,0
 2020 PRINT AT 4,8; PAPER 0; PEN 2;"  YOU FAIL IT!  ": ZAP : POW : ZAP : POW : ZAP 
 2030 CASH ad: PRINT AT 7,8.5-0.5*LEN cash$;"You collected "; PEN 9;cash$: ZOOM 
 2040 LET hf=0: CHECKHISC
 2050 IF hf=1 THEN NEWHISC 0
 2060 IF hf=0 THEN CASH FN h(): PRINT AT 10,6-0.5*LEN cash$;"High score is still"; PEN 6;cash$: BOOM : BOOM : BOOM 
 2070 PRINT AT 13,3;"At least Ford can now rest"; AT 14,3;"in peace...  or... pieces!": ZOOM : ZOOM : ZOOM : POW : BOOM 
 2080 PAUSE 1: PRINT AT 17,5;"Press   to revive Ford"; AT 18,8;"and play again..."; AT 17,11; PAPER 10; PEN 3;"R"; AT 16,11; PAPER bg; PEN 10;"_"
 2090 GET k$
 2100 IF k$="r" OR k$="R" THEN GO TO 80
 2110 PRINT AT 0,0;STRING$(513," ")
 7000 REM ** INTRO
 7010 MODE 4: CSIZE 8,8: BORDER 0: PAPER 0: INVERSE 0: OVER 0: CLS : WALLS 0,15
 7020 FOR n=11 TO 14: PALETTE n,127: NEXT n
 7030 PEN 11: BLOCKV 42,151,32,4,0: BLOCKV 42,151,24,4,10: BLOCKV 62,151,24,4,-10: BLOCKV 62,151,32,4,0
 7040 PEN 12: BLOCKH 70,151,12,4,0: BLOCKV 74,147,24,4,0: BLOCKH 70,123,12,4,0
 7050 PEN 13: BLOCKV 86,151,32,4,0: BLOCKV 86,151,32,4,16: BLOCKV 102,151,32,4,0
 7060 PEN 14: BLOCKV 110,151,32,4,0: BLOCKH 114,151,16,4,0: BLOCKH 114,137,12,4,0: BLOCKH 114,123,16,4,0
 7070 PEN 11: SEMIV 134,151,1: BLOCKH 134,142,24,4,-10: SEMIV 134,131,-1
 7080 PEN 12: SEMIV 174,151,1: BLOCKV 174,139,8,4,0: BLOCKV 194,139,8,4,0: SEMIV 174,131,-1
 7090 PEN 13: BLOCKV 202,151,32,4,0: BLOCKH 206,151,16,4,0: BLOCKH 206,137,12,4,0
 7100 PEN 14: BLOCKV 20,103,32,4,0: BLOCKV 20,103,24,4,10: BLOCKV 40,103,24,4,-10: BLOCKV 40,103,32,4,0
 7110 PEN 11: BLOCKV 56,103,32,4,-8: BLOCKV 56,103,32,4,8: BLOCKH 54,83,8,4,0
 7120 PEN 12: SEMIV 72,103,1: BLOCKV 72,91,8,4,0: SEMIV 72,83,-1: BLOCKH 84,87,12,4,0
 7130 PEN 13: BLOCKV 100,103,32,4,0: BLOCKH 104,103,4,4,0: BLOCKH 104,83,4,4,0: SEMIH 108,103,1: BLOCKV 109,83,12,4,7
 7140 PEN 14: BLOCKV 132,103,32,4,-8: BLOCKV 132,103,32,4,8: BLOCKH 130,83,8,4,0
 7150 PEN 11: BLOCKH 144,103,20,4,0: BLOCKV 152,99,28,4,0
 7160 PEN 12: BLOCKV 168,103,32,4,0: BLOCKH 172,89,12,4,0: BLOCKV 184,103,32,4,0
 7170 PEN 13: BLOCKV 192,103,32,4,0: BLOCKH 196,103,16,4,0: BLOCKH 196,89,12,4,0: BLOCKH 196,75,16,4,0
 7180 PEN 14: BLOCKV 224,103,32,4,-8: BLOCKV 224,103,32,4,8: BLOCKH 222,83,8,4,0
 7185 IF PEEK (3+UDG CHR$ 168)>0 THEN GO TO 7215
 7190 PEN 8: PRINT AT 15,6;"SAM COUPE VERSION BY"; AT 16,2; PEN 2;"JIM WATERMAN - NOVEMBER 2022": PLOT 116,57: DRAW 1,1
 7200 PRINT AT 17,3; PEN 9;"UPGRADED FROM THE ORIGINAL"; AT 18,7; PEN 6;"BY PAUL E. COLLINS"; AT 19,6; PEN 7;"FROM THE 2021 CSSCGC": PEN 7
 7210 HHGGTHEME: FOR n=14 TO 19: PRINT AT n,1;STRING$(30," "): NEXT n
 7215 POKE (3+UDG CHR$ 168),1: PEN 7
 7220 PRINT AT 15,4;"Press I for instructions"; AT 16,2;"or your skill level to start"; AT 18,4; PEN 4;"1 = easy"; PEN 7;"   to   "; PEN 2;"4 = hard"
 7230 PRINT AT 15,10; PAPER 10; PEN 6;"I"; AT 14,10; PAPER 0; PEN 10;"_"
 7240 FOR n=11 TO 14: PALETTE n,j(INT (RND*8)+1): NEXT n
 7250 LET sk=CODE INKEY$
 7260 IF sk=105 OR sk=73 THEN ZOOM : GO TO 8000
 7270 IF sk>48 AND sk<53 THEN BOOM : LET sk=sk-48: GO TO 80
 7280 GO TO 7240
 8000 REM ** INSTRUCTIONS
 8010 MODE 3: CSIZE 8,8: PAPER 3: PALETTE 1,124: PEN 0: CLS : LET o$=CHR$ 150+CHR$ 151
 8020 FOR n=0 TO 20 STEP 2: PRINT AT n,0; PAPER 3;o$;STRING$(60," ");o$; PAPER 1;o$;STRING$(60," ");o$;: NEXT n
 8030 PEN 0: CASH ot
 8040 PRINT AT 0,4;"*** MINES OF MAGRATHEA - INSTRUCTIONS ***"
 8050 PRINT AT 2,4;"Ford Prefect never was very responsible with money. And"; PAPER 1; AT 3,4;"when he (not exactly legitimately) obtained an unlimited"; PAPER 3; AT 4,4;"Dine-O-Charge card from the Hitch-Hiker's Guide To The"; PAPER 1; AT 5,4;"Galaxy's accounting department, change was never likely!"
 8060 PRINT PAPER 1; AT 7,4;"Ford has been so reckless with the card that he has left"; PAPER 3; AT 8,4;"a hole in the Guide's bank account to the tune of"; PAPER 1; AT 9,4;cash$(2 TO );" Altairian dollars..."
 8070 PRINT PAPER 1; AT 11,4;"...and he seems to have forgotten that the Guide is now"; PAPER 3; AT 12,4;"owned by the Vogons - whose fanatical zeal for needless"; PAPER 1; AT 13,4;"bureaucracy will see them chase down both missing money"; PAPER 3; AT 14,4;"and errant employees to the end of the Universe... and"; PAPER 1; AT 15,4;"beyond, if necessary (or even if not)!"
 8080 PRINT PAPER 1; AT 17,4;"There is only one way Ford can think of to be able to"; PAPER 3; AT 18,4;"account for every penny he owes, and avoid a horrific"; PAPER 1; AT 19,4;"demise at the hand of Prostetnic Vogon Jeltz and his"; PAPER 3; AT 20,4;"legendarily torturous poetry recitals..."
 8090 PRINT #0; AT 1,16;"PRESS ANY KEY FOR THE NEXT PAGE"
 8100 GET k$
 8110 FOR n=0 TO 20 STEP 2: PRINT AT n,0; PAPER 3;o$;STRING$(60," ");o$; PAPER 1;o$;STRING$(60," ");o$;: NEXT n
 8120 PRINT AT 0,4;"It is well known that the Magratheans are rich beyond"; PAPER 1; AT 1,4;"even Zaphod Beeblebrox's wildest dreams - and they have"; PAPER 3; AT 2,4;"to keep all their cash stashed away somewhere. The"; PAPER 1; AT 3,4;"Galactic banks can't deal with such vast amounts as the"; PAPER 3; AT 4,4;"interest they'd have to pay would cripple them."
 8130 PRINT AT 6,4;"Ford must descend into the Mines of Magrathea, where he"; PAPER 1; AT 7,4;"will find some bags of piffling small change, or at"; PAPER 3; AT 8,4;"least it is to the locals. However, the one time he ever"; PAPER 1; AT 9,4;"visited Magrathea, he and his cohorts on the Heart of"; PAPER 3; AT 10,4;"Gold were not given a particularly friendly welcome..."
 8140 PRINT AT 12,4;"The Mines of Magrathea are as well-defended as the"; PAPER 1; AT 13,4;"planet's outer orbits - but instead of surface-to-space"; PAPER 3; AT 14,4;"missiles, the Magratheans have booby-trapped their mines"; PAPER 1; AT 15,4;"with... mines. They are only visible for a couple of"; PAPER 3; AT 16,4;"seconds - when they disappear, Ford had better hope his"; PAPER 1; AT 17,4;"memory hasn't been wrecked by all those Pan-Galactic"; PAPER 3; AT 18,4;"Gargle Blasters!"
 8150 PRINT #0; AT 1,16;"PRESS ANY KEY FOR THE NEXT PAGE"
 8160 GET k$
 8170 FOR n=0 TO 20 STEP 2: PRINT AT n,0; PAPER 3;o$;STRING$(60," ");o$; PAPER 1;o$;STRING$(60," ");o$;: NEXT n
 8180 PRINT AT 0,4;"In this game, as should come as a surprise to absolutely"; PAPER 1; AT 1,4;"no one, you control Ford Prefect in his quest to pay off"; PAPER 3; AT 2,4;"his debts. You must guide him through the caves under"; PAPER 1; AT 3,4;"the surface of Magrathea - in each cave, find a route to"; PAPER 3; AT 4,4;"the bag of cash, avoiding the invisible mines, and"; PAPER 1; AT 5,4;"return to the entryway to reveal the amount in the bag."
 8190 PRINT PAPER 1; AT 7,4;"Each bag contains a random amount from ";CHR$ 149;"10,000 to over"; PAPER 3; AT 8,4;CHR$ 149;"120,000 - though this is weighted towards the centre."; PAPER 1; AT 9,4;"The game can be completed by looting as little as 11"; PAPER 3; AT 10,4;"caves, but it could take as many as 133 if you're really"; PAPER 1; AT 11,4;"unlucky! On average, it should take around 20-25 caves."
 8200 PRINT PAPER 1; AT 13,4;"An easy game (level 1) puts 20 mines in the first cave,"; PAPER 3; AT 14,4;"with each further level increasing that by 10. Each cave"; PAPER 1; AT 15,4;"will have one more mine than the last."
 8210 PRINT PAPER 1; AT 17,4;"The controls are Q/A/O/P, as you'd expect."; AT 19,4;"Best of luck - you're going to need a lot of it!"; AT 21,4;"*** MESSAGE ENDS ***"
 8250 PRINT #0; AT 1,11;"PRESS ANY KEY TO RETURN TO THE MAIN SCREEN"
 8260 GET k$
 8270 GO TO 7000
10000 DEF PROC UDGSETUP
10005 LOCAL n,b
10010 RESTORE 10021: FOR n=UDG CHR$ 144 TO 7+UDG CHR$ 151: READ b: POKE n,b: NEXT n
10021 DATA 60,126,60,24,126,189,36,102
10022 DATA 16,90,60,238,127,60,90,16
10023 DATA 221,153,9,131,129,192,145,59
10024 DATA 224,254,35,117,97,85,97,62
10025 DATA 12,22,43,85,107,125,106,60
10026 DATA 8,62,9,63,73,75,61,8
10027 DATA 0,0,3,15,15,3,0,0
10028 DATA 0,0,192,240,240,192,0,0
10030 FOR n=0 TO 2: POKE (n+UDG CHR$ 168),0: NEXT n
10090 END PROC 
10100 DEF PROC PALSETUP
10105 LOCAL n,c
10110 RESTORE 10120: FOR n=0 TO 15: READ c: PALETTE n,c: NEXT n
10120 DATA 0,17,34,51,68,85,102,119,36,98,49,127,127,127,127,7
10190 END PROC 
10200 DEF PROC WALLS w,wc
10205 LOCAL n
10210 PRINT PEN wc; AT 0,0;STRING$(32,CHR$ 148); AT 21,0;STRING$(16,CHR$ 148); AT 21,16;(CHR$ 148 AND w=0); AT 21,17;STRING$(15,CHR$ 148)
10220 FOR n=1 TO 20: PRINT PEN wc; AT n,0;CHR$ 148; AT n,31;CHR$ 148: NEXT n
10290 END PROC 
10300 DEF PROC FANFARE
10305 LOCAL l
10310 LET l=.075: LET d=7
10320 BEEP l,-5+d: BEEP l,d: BEEP l,4+d: BEEP 2*l,7+d: BEEP l,4+d: BEEP 2*l,7+d
10390 END PROC 
10400 DEF PROC ASPLODE
10405 LOCAL n,m,p,x,y,dx,dy
10410 PALETTE 11,0: FOR m=1 TO 5: RESTORE 10420: FOR n=1 TO 14: READ p: PRINT AT a,b; PEN 11;CHR$ 145: PALETTE 11,p: NEXT n: POW : NEXT m
10420 DATA 8,7,15,112,120,119,127,119,120,112,15,7,8,0
10430 LET x=3+8*b: LET y=172-(8*a)
10440 FOR n=1 TO 20
10450 LET dx=INT (RND*23)-11: LET dy=INT (RND*23)-11: LET i=INT (RND*3)
10460 PEN (2 AND i=0)+(6 AND i=1)+(9 AND i=2): PLOT x,y: DRAW dx,dy
10470 NEXT n: POW : POW : POW : POW : POW : PEN 0
10480 CSIZE 8,16: PRINT #0; PAPER 0; AT 1,0;STRING$(32," ");
10490 PRINT #0; PAPER 0; PEN 2; AT 1,7;"YOUR": ZAP : FOR n=1 TO 100: NEXT n
10500 PRINT #0; PAPER 0; PEN 2; AT 1,12;"HEAD": ZAP : FOR n=1 TO 100: NEXT n
10510 PRINT #0; PAPER 0; PEN 2; AT 1,17;"A": ZAP : FOR n=1 TO 100: NEXT n
10520 PRINT #0; PAPER 0; PEN 2; AT 1,19;"SPLODE": ZAP : FOR n=1 TO 100: NEXT n
10580 CSIZE 8,8
10590 END PROC 
10600 DEF PROC CHECKHISC
10610 IF ad<=FN h() THEN GO TO 10690
10630 LET hh=INT (ad/65536): LET hf=ad-65536*hh
10640 LET hm=INT (hf/256): LET hl=hf-256*hm
10650 POKE UDG CHR$ 168,hl: POKE (1+UDG CHR$ 168),hm: POKE (2+UDG CHR$ 168),hh
10660 LET hf=1
10690 END PROC 
10700 DEF PROC NEWHISC w
10705 LOCAL n,m,c,q$
10710 LET q$="It's a new high score!"
10720 FOR n=1 TO 8
10730 RESTORE 10770: FOR m=1 TO 4
10740 READ c: PALETTE 12,c: PRINT AT 10+2*w,5; PEN 12;q$
10750 NEXT m: NEXT n
10760 ZOOM : ZOOM : ZOOM 
10770 DATA 36,102,68,102
10790 END PROC 
10800 DEF PROC CASH s
10810 LET cash$=STR$ s
10820 IF LEN cash$>6 THEN LET cash$=cash$( TO LEN cash$-6)+","+cash$(LEN cash$-5 TO )
10830 IF LEN cash$>3 THEN LET cash$=cash$( TO LEN cash$-3)+","+cash$(LEN cash$-2 TO )
10840 LET cash$=CHR$ 149+cash$
10890 END PROC 
11000 DEF PROC BLOCKV x,y,l,w,dx
11005 LOCAL n
11010 FOR n=0 TO w-1: PLOT x+n,y: DRAW dx,-l+1: NEXT n
11020 END PROC 
11030 DEF PROC BLOCKH x,y,l,w,dy
11035 LOCAL n
11040 FOR n=0 TO w-1: PLOT x,y-n: DRAW l-1,dy: NEXT n
11050 END PROC 
11090 DEF PROC SEMIV x,y,p
11095 LOCAL n
11100 RESTORE semi
11110 FOR n=1 TO 20
11120 READ dx,dy,l
11130 PLOT x+dx,y-11*(p=-1)-(dy*p): DRAW l,0
11140 NEXT n
11150 END PROC 
11160 DEF PROC SEMIH x,y,p
11165 RESTORE semi
11170 FOR n=1 TO 20
11180 READ dy,dx,l
11190 PLOT x+11*(p=1)-(dx*p),y-dy: DRAW 0,-l
11200 NEXT n
11210 END PROC 
11220 LABEL semi: DATA 9,0,5,6,1,11,4,2,15,3,3,17,2,4,6,15,4,6,2,5,4,17,5,4,1,6,4,18,6,4,1,7,3,19,7,3,1,8,3,19,8,3,0,9,3,20,9,3,0,10,3,20,10,3,0,11,3,20,11,3
12000 DEF PROC INTROCOLARRAY
12005 LOCAL n
12010 DIM j(8): RESTORE 12030
12020 FOR n=1 TO 8: READ j(n): NEXT n
12030 DATA 23,39,55,71,87,103,119,99
12040 END PROC 
12100 DEF PROC HHGGTHEME
12105 LOCAL n,d,p,m,o
12110 LET m=.125: RESTORE 12180
12120 FOR n=1 TO 34
12130 READ d,p
12140 IF d=0 THEN FOR o=1 TO p*m*500: NEXT o
12150 IF d<>0 THEN BEEP d*m,p
12160 NEXT n
12180 DATA 1,10,0,1,4,9,1,7,1,5,1,3,1,2,1,0,0,1,4,0
12181 DATA 1,10,0,1,4,9,1,7,1,5,7,3,0,1
12182 DATA 1,10,0,1,4,9,1,7,1,5,1,3,1,2,1,0,0,1,4,0
12183 DATA 1,3,0,1,4,5,1,3,1,2,4,0,0,4
12190 END PROC 
12200 DEF PROC INTEREST
12205 LOCAL i
12210 LET i=(INT (RND*100*(sk-1)))/10: LET target=INT (target*(1+(i/100))): CASH target
12220 WALLS 1,ro: PLOT 71,145: DRAW 113,0: DRAW 0,-10: DRAW -113,0: DRAW 0,10
12230 IF i=0
12240 PRINT AT 4,9; PAPER 3; PEN 10;"  GOOD NEWS!  "
12250 PLOT PEN 3;72,144: DRAW PEN 3;111,0
12260 PRINT AT 7,2;"There is no interest to pay"; AT 8,3;"on the Dine-O-Charge card,"; AT 9,3;"so your target remains at"; AT 10,15.5-0.5*LEN cash$; PEN 6;cash$; PEN 0;"."
12270 ELSE PRINT AT 4,9; PAPER 2; PEN 9;"  BAD  NEWS!  "
12280 PLOT PEN 2;72,144: DRAW PEN 2;111,0
12290 PRINT AT 7,2;"The Guide's accountants have"; AT 8,2;"determined that you need to"; AT 9,5.5-0.5*LEN STR$ i;"pay "; PEN 9;i;"%"; PEN 0;" interest on the"; AT 10,2;"Dine-O-Charge card, so your"; AT 11,8-0.5*LEN cash$;"target will be "; PEN 6;cash$; PEN 0;"."
12300 END IF 
12310 PRINT AT 17,2;"Prepare for the first cave..": PLOT 232,33: DRAW 1,0: DRAW 0,1: DRAW -1,0
12320 PAUSE 200: FOR n=1 TO 20: PRINT AT n,1;STRING$(30," "): NEXT n
12330 END PROC 
